package com.jeeplus.test.jlnu.admissionInfo.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.AdmissionInfo;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.ImportFailLog;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.JlnuTeachingArchives;
import com.jeeplus.test.jlnu.admissionInfo.domain.entity.Supplement;
import com.jeeplus.test.jlnu.admissionInfo.domain.vo.AdmissionInfoDto;
import com.jeeplus.test.jlnu.admissionInfo.domain.vo.AdmissionInfoReqVo;
import com.jeeplus.test.jlnu.admissionInfo.domain.vo.AdmissionInfoRespVo;
import com.jeeplus.test.jlnu.archivalInfo.domain.entity.ArchivalInfo;
import com.jeeplus.test.jlnu.degreeInfo.domain.entity.DegreeInfo;
import com.jeeplus.test.jlnu.employmentInfo.domain.entity.EmploymentInfo;
import com.jeeplus.test.jlnu.graduationInfo.domain.entity.GraduationInfo;
import com.jeeplus.test.jlnu.mailingInfo.domain.entity.MailingInfo;
import com.jeeplus.test.jlnu.qualificationInfo.domain.entity.QualificationInfo;
import com.jeeplus.test.jlnu.studentStatusInfo.domain.entity.StudentStatusInfo;
import com.jeeplus.test.postgraduate.domain.vo.PostgraduateReqVo;
import org.apache.ibatis.annotations.*;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

import java.util.List;

@Mapper
public interface AdmissionInfoMapper {

    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "class_id", property = "classId"),
            @Result(column = "archival_num", property = "archivalNum"),
            @Result(column = "case_title", property = "caseTitle"),
            @Result(column = "file_title", property = "fileTitle"),
            @Result(column = "save_location", property = "saveLocation"),
            @Result(column = "page_location", property = "pageLocation"),
            @Result(column = "page_num", property = "pageNum"),
            @Result(column = "examinee_num", property = "examineeNum"),
            @Result(column = "admission_num", property = "admissionNum"),
            @Result(column = "student_id", property = "studentId"),
            @Result(column = "name", property = "name"),
            @Result(column = "gender", property = "gender"),
            @Result(column = "birthday", property = "birthday"),
            @Result(column = "political_outlook", property = "politicalOutlook"),
            @Result(column = "nation", property = "nation"),
            @Result(column = "id_card", property = "idCard"),
            @Result(column = "plan_nature", property = "planNature"),
            @Result(column = "admission_schools", property = "admissionSchools"),
            @Result(column = "admission_academy", property = "admissionAcademy"),
            @Result(column = "admission_major", property = "admissionMajor"),
            @Result(column = "admission_time", property = "admissionTime"),
            @Result(column = "gradation", property = "gradation"),
            @Result(column = "educational_system", property = "educationalSystem"),
            @Result(column = "learning_forms", property = "learningForms"),
            @Result(column = "examinee_sort", property = "examineeSort"),
            @Result(column = "batch", property = "batch"),
            @Result(column = "graduation_school", property = "graduationSchool"),
            @Result(column = "source_area", property = "sourceArea"),
            @Result(column = "area_name", property = "areaName"),
            @Result(column = "home_address", property = "homeAddress"),
            @Result(column = "postal_code", property = "postalCode"),
            @Result(column = "phone_num", property = "phoneNum"),
            @Result(column = "info_source", property = "infoSource"),
            @Result(column = "remarks", property = "remarks"),
            @Result(column = "category", property = "category"),
            @Result(column = "ext1", property = "ext1"),
            @Result(column = "ext2", property = "ext2"),
            @Result(column = "ext3", property = "ext3"),
            @Result(column = "ext4", property = "ext4"),
            @Result(column = "ext5", property = "ext5"),
            @Result(column = "ext6", property = "ext6"),
            @Result(column = "ext7", property = "ext7"),
            @Result(column = "ext8", property = "ext8"),
            @Result(column = "ext9", property = "ext9"),
            @Result(column = "ext10", property = "ext10"),
            @Result(column = "ext11", property = "ext11"),
            @Result(column = "ext12", property = "ext12"),
            @Result(column = "ext13", property = "ext13"),
            @Result(column = "ext14", property = "ext14"),
            @Result(column = "ext15", property = "ext15"),
            @Result(column = "ext16", property = "ext16"),
            @Result(column = "ext17", property = "ext17"),
            @Result(column = "ext18", property = "ext18"),
            @Result(column = "ext19", property = "ext19"),
            @Result(column = "ext20", property = "ext20"),
            @Result(column = "archive_code", property = "archiveCode"),
            @Result(column = "full_set_code", property = "fullSetCode"),
            @Result(column = "category_code", property = "categoryCode"),
            @Result(column = "category_id", property = "categoryId"),
            @Result(column = "project_id", property = "projectId"),
            @Result(column = "directory_code", property = "directoryCode"),
            @Result(column = "annual", property = "annual"),
            @Result(column = "retention_period_code", property = "retentionPeriodCode"),
            @Result(column = "institution", property = "institution"),
            @Result(column = "case_number", property = "caseNumber"),
            @Result(column = "item_number", property = "itemNumber"),
            @Result(column = "document_title", property = "documentTitle"),
            @Result(column = "date_time", property = "dateTime"),
            @Result(column = "responsible_person", property = "responsiblePerson"),
            @Result(column = "specification", property = "specification"),
            @Result(column = "item_count", property = "itemCount"),
            @Result(column = "page_count", property = "pageCount"),
            @Result(column = "retention_period", property = "retentionPeriod"),
            @Result(column = "confidentiality_level", property = "confidentialityLevel"),
            @Result(column = "disclosure_attribute", property = "disclosureAttribute"),
            @Result(column = "open_flag", property = "openFlag"),
            @Result(column = "remark", property = "remark"),
            @Result(column = "keywords", property = "keywords"),
            @Result(column = "storage_location", property = "storageLocation"),
            @Result(column = "cataloger", property = "cataloger"),
            @Result(column = "catalog_date", property = "catalogDate"),
            @Result(column = "archiving_unit", property = "archivingUnit"),
            @Result(column = "archiver", property = "archiver"),
            @Result(column = "archive_time", property = "archiveTime"),
            @Result(column = "electronic_document", property = "electronicDocument"),
            @Result(column = "electronic_document_metadata", property = "electronicDocumentMetadata"),
            @Result(column = "notes", property = "notes"),
            @Result(column = "transfer_state", property = "transferState"),
            @Result(column = "transfer_remarks", property = "transferRemarks"),
            @Result(column = "year", property = "year"),
            @Result(column = "approve_state", property = "approveState"),
    })
    @Select({
            "<script>",
            "SELECT a.*, b.* FROM jlnu_admission_info a",
            "LEFT JOIN jlnu_teacthing_archives b ON a.student_id = b.student_id",
            "LEFT JOIN sys_office t3 ON a.office_id = t3.id",
            "LEFT JOIN jlnu_deans_office x ",
            "on (a.student_id = x.xh OR a.examinee_num = x.ksh OR a.admission_num = x.zkzh) and a.id_card = x.sfzh ",
            "LEFT JOIN jlnu_postgraduate y ",
            "on (a.student_id = y.zxshxh OR a.examinee_num = y.zh OR a.admission_num = y.zkzh) and a.id_card = y.sfzh ",
            "LEFT JOIN jlnu_education_info z ",
            "on (a.student_id = z.student_id OR a.examinee_num = z.ksh OR a.admission_num = z.zkzh) and a.id_card = z.sfzh ",
            "WHERE 1=1",
            // 用户权限过滤
            "<if test='admissionInfoReqVo.userId != null'>",
            "   AND EXISTS (",
            "       SELECT 1 FROM sys_office_user sou",
            "       WHERE sou.office_id = a.office_id",
            "       AND sou.user_id = #{admissionInfoReqVo.userId}",
            "       AND sou.status = 1",
            "   )",
            "</if>",
            // 审批状态过滤
            "<if test='admissionInfoReqVo.approveStateList != null and admissionInfoReqVo.approveStateList.size() > 0'>",
            "   AND a.approve_state IN",
            "   <foreach item='item' collection='admissionInfoReqVo.approveStateList' open='(' separator=',' close=')'>",
            "       #{item}",
            "   </foreach>",
            "</if>",
            // 转档状态过滤
            "<if test='admissionInfoReqVo.transferStateList != null and admissionInfoReqVo.transferStateList.size() > 0'>",
            "   AND a.transfer_state IN",
            "   <foreach item='item' collection='admissionInfoReqVo.transferStateList' open='(' separator=',' close=')'>",
            "       #{item}",
            "   </foreach>",
            "</if>",
            "<if test='admissionInfoReqVo.gradation != null and admissionInfoReqVo.gradation != \"\"'>",
            "   AND a.gradation = #{admissionInfoReqVo.gradation}",
            "</if>",
            "<if test='admissionInfoReqVo.year != null and admissionInfoReqVo.year != \"\"'>",
            "   AND a.year = #{admissionInfoReqVo.year}",
            "</if>",
            "<if test='admissionInfoReqVo.recordType != null and admissionInfoReqVo.recordType != \"\"'>",
            "   AND a.record_type = #{admissionInfoReqVo.recordType}",
            "</if>",
            "<if test='admissionInfoReqVo.admissionMajor != null and admissionInfoReqVo.admissionMajor != \"\"'>",
            "   AND a.admission_major = #{admissionInfoReqVo.admissionMajor}",
            "</if>",
            "<if test='admissionInfoReqVo.recordType != null and admissionInfoReqVo.recordType != \"\"'>",
            "   AND a.record_Type = #{admissionInfoReqVo.recordType}",
            "</if>",
            // 动态条件查询（安全增强版）
            "<if test='admissionInfoReqVo.conditions != null and admissionInfoReqVo.conditions.size() > 0'>",
            "   AND (",
            "   <foreach collection='admissionInfoReqVo.conditions' item='condition' index='index'>",
            "       <if test='condition.field != null and condition.field != \"\" and condition.values != null'>",
            "           <if test='index != 0'>",
            "               <choose>",
            "                   <when test='admissionInfoReqVo.conditions[index-1].logic != null and admissionInfoReqVo.conditions[index-1].logic == \"OR\"'>",
            "                       OR",
            "                   </when>",
            "                   <otherwise>AND</otherwise>",
            "               </choose>",
            "           </if>",
            "           <bind name='querySql' value='@com.jeeplus.test.education.util.SmartFieldConverter@convert(condition.querySql)'/>",
            "           <choose>",
            "               <when test='condition.operator == \"contains\"'>",
            "                   ${querySql} LIKE CONCAT('%', #{condition.values}, '%')",
            "               </when>",
            "               <when test='condition.operator == \"notContains\"'>",
            "                   (${querySql} IS NULL OR ${querySql} NOT LIKE CONCAT('%', #{condition.values}, '%'))",
            "               </when>",
            "               <when test='condition.operator == \"equals\"'>",
            "                   ${querySql} = #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"notEquals\"'>",
            "                   ${querySql} != #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"isNull\"'>",
            "                   (${querySql} IS NULL OR ${querySql} = '')",
            "               </when>",
            "               <when test='condition.operator == \"isNotNull\"'>",
            "                   (${querySql} IS NOT NULL AND ${querySql} != '')",
            "               </when>",
            "               <when test='condition.operator == \"lt\"'>",
            "                   ${querySql} &lt; #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"gt\"'>",
            "                   ${querySql} &gt; #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"lte\"'>",
            "                   ${querySql} &lt;= #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"gte\"'>",
            "                   ${querySql} &gt;= #{condition.values}",
            "               </when>",
            "               <when test='condition.operator == \"in\"'>",
            "                   ${querySql} IN",
            "                   <foreach item='item' collection='condition.values' open='(' separator=',' close=')'>",
            "                       #{item}",
            "                   </foreach>",
            "               </when>",
            "               <when test='condition.operator == \"notIn\"'>",
            "                   ${querySql} NOT IN",
            "                   <foreach item='item' collection='condition.values' open='(' separator=',' close=')'>",
            "                       #{item}",
            "                   </foreach>",
            "               </when>",

            "<when test='condition.operator == \"between\"'>",
            "   <![CDATA[ ${querySql} BETWEEN #{condition.values[0]} AND #{condition.values[1]} ]]>",
            "</when>",
            "               <otherwise>",
            "                   ${querySql} LIKE CONCAT('%', #{condition.values}, '%')",
            "               </otherwise>",
            "           </choose>",
            "       </if>",
            "   </foreach>",
            "   )",
            "</if>",
            "</script>"
    })
    Page<AdmissionInfoRespVo> getAdmissionInfoPage(AdmissionInfoReqVo admissionInfoReqVo,Page<AdmissionInfoRespVo> page);

    List<AdmissionInfo> selectList();

    List<AdmissionInfo> selectByOfficeId(String officeId);
    @Update({
            "<script>",
            "UPDATE jlnu_admission_info",
            "<set>",
            "archival_num = CASE WHEN #{admissionUpdateDto.archivalNum} IS NOT NULL AND #{admissionUpdateDto.archivalNum} != '' THEN #{admissionUpdateDto.archivalNum} ELSE archival_num END,",
            "case_title = CASE WHEN #{admissionUpdateDto.caseTitle} IS NOT NULL AND #{admissionUpdateDto.caseTitle} != '' THEN #{admissionUpdateDto.caseTitle} ELSE case_title END,",
            "class_id = CASE WHEN #{admissionUpdateDto.classId} IS NOT NULL AND #{admissionUpdateDto.classId} != '' THEN #{admissionUpdateDto.classId} ELSE class_id END,",
            "id_card = CASE WHEN #{admissionUpdateDto.idCard} IS NOT NULL AND #{admissionUpdateDto.idCard} != '' THEN #{admissionUpdateDto.idCard} ELSE id_card END,",
            "learning_forms = CASE WHEN #{admissionUpdateDto.learningForms} IS NOT NULL AND #{admissionUpdateDto.learningForms} != '' THEN #{admissionUpdateDto.learningForms} ELSE learning_forms END,",
            "page_location = CASE WHEN #{admissionUpdateDto.pageLocation} IS NOT NULL AND #{admissionUpdateDto.pageLocation} != '' THEN #{admissionUpdateDto.pageLocation} ELSE page_location END,",
            "page_num = CASE WHEN #{admissionUpdateDto.pageNum} IS NOT NULL AND #{admissionUpdateDto.pageNum} != '' THEN #{admissionUpdateDto.pageNum} ELSE page_num END,",
            "political_outlook = CASE WHEN #{admissionUpdateDto.politicalOutlook} IS NOT NULL AND #{admissionUpdateDto.politicalOutlook} != '' THEN #{admissionUpdateDto.politicalOutlook} ELSE political_outlook END,",
            "remarks = CASE WHEN #{admissionUpdateDto.remarks} IS NOT NULL AND #{admissionUpdateDto.remarks} != '' THEN #{admissionUpdateDto.remarks} ELSE remarks END",
            "</set>",
            "WHERE student_id IN",
            "<foreach collection='studentIds' item='studentId' open='(' separator=',' close=')'>",
            "#{studentId}",
            "</foreach>",
            "</script>"
    })

    int batchUpdate(@Param("studentIds") List<String> studentIds,
                    @Param("admissionUpdateDto") AdmissionInfoDto admissionUpdateDto);
    @Select("SELECT DISTINCT  a.*, " +
            "b.grade AS grade, " +
            "b.class_id AS classId, " +
            "b.material_id AS materialId, " +
            "b.material_sort AS materialSort, " +
            "b.material_name AS materialName, " +
            "b.responsible_person AS responsiblePerson, " +
            "b.date_time AS dateTime, " +
            "b.standards AS standards, " +
            "b.quantity AS quantity, " +
            "b.page_count AS pageCount, " +
            "b.archive_unit AS archiveUnit, " +
            "b.transferor AS transferor, " +
            "b.receiver AS receiver, " +
            "b.transfer_time AS transferTime, " +
            "b.archival_status AS archivalStatus, " +
            "c.degree_certificate_num AS degreeCertificateNum, " +
            "c.degree_certificate_date AS degreeCertificateDate, " +
            "c.degree_level AS degreeLevel, " +
            "c.officer_id_num AS officerIdNum, " +
            "c.entrance_date AS entranceDate, " +
            "c.graduation_date AS graduationDate, " +
            "d.age AS age, " +
            "d.school_code AS schoolCode, " +
            "d.graduation_college AS graduationCollege, " +
            "d.major_code AS majorCode, " +
            "d.qualification AS qualification, " +
            "d.completion_conclusion AS completionConclusion, " +
            "d.graduation_destination AS graduationDestination, " +
            "d.employment_name AS employmentName, " +
            "d.employment_address AS employmentAddress, " +
            "d.archive_transfer_num AS archiveTransferNum, " +
            "d.archive_transfer_sort AS archiveTransferSort, " +
            "d.receive_postal_code AS receivePostalCode, " +
            "d.receive_unit_name AS receiveUnitName, " +
            "d.receive_unit_address AS receiveUnitAddress, " +
            "d.receive_unit_address_code AS receiveUnitAddressCode, " +
            "d.archive_receiver AS archiveReceiver, " +
            "d.archive_receiver_phone AS archiveReceiverPhone, " +
            "d.sender AS sender, " +
            "d.send_time AS sendTime, " +
            "d.ship_method AS shipMethod, " +
            "d.tracking_number AS trackingNumber, " +
            "d.receipt AS receipt, " +
            "d.student_phone_num AS studentPhoneNum, " +
            "e.diploma_num AS diplomaNum, " +
            "e.diploma_date AS diplomaDate, " +
            "e.degree_type AS degreeType, " +
            "e.discipline_major AS disciplineMajor, " +
            "e.supervisor AS supervisor, " +
            "e.thesis_title AS thesisTitle, " +
            "e.president_name AS presidentName, " +
            "e.correspondence_station AS correspondenceStation, " +
            "f.native_place AS nativePlace, " +
            "f.study_start_time AS studyStartTime, " +
            "f.study_end_time AS studyEndTime, " +
            "f.document_title AS documentTitle, " +
            "f.document_date AS documentDate, " +
            "g.expected_graduation_date AS expectedGraduationDate, " +
            "g.details AS details, " +
            "g.change_date AS changeDate, " +
            "g.change_sort AS changeSort, " +
            "g.change_content AS changeContent, " +
            "g.name_before_change AS nameBeforeChange, " +
            "g.name_changed AS nameChanged " +
            "FROM jlnu_admission_info a " +
            "JOIN jlnu_archival_info b ON a.student_id = b.student_id " +
            "JOIN jlnu_degree_info c ON a.student_id = c.student_id " +
            "JOIN jlnu_employment_info d ON a.student_id = d.student_id " +
            "JOIN jlnu_graduation_info e ON a.student_id = e.student_id " +
            "JOIN jlnu_qualification_info f ON a.student_id = f.student_id " +
            "JOIN jlnu_student_status_info g ON a.student_id = g.student_id " +
            "WHERE a.student_id = #{stuId}")
    Supplement selectNullByStuId(String stuId);
    @Update({
            "<script>",
            "UPDATE jlnu_archival_info",
            "<set>",
            "student_id = #{archivalInfo.studentId},",
            "<if test='archivalInfo.grade != null and archivalInfo.grade != \"\"'>grade = #{archivalInfo.grade},</if>",
            "<if test='archivalInfo.classId != null and archivalInfo.classId != \"\"'>class_id = #{archivalInfo.classId},</if>",
            "<if test='archivalInfo.materialId != null and archivalInfo.materialId != \"\"'>material_id = #{archivalInfo.materialId},</if>",
            "<if test='archivalInfo.materialSort != null and archivalInfo.materialSort != \"\"'>material_sort = #{archivalInfo.materialSort},</if>",
            "<if test='archivalInfo.materialName != null and archivalInfo.materialName != \"\"'>material_name = #{archivalInfo.materialName},</if>",
            "<if test='archivalInfo.responsiblePerson != null and archivalInfo.responsiblePerson != \"\"'>responsible_person = #{archivalInfo.responsiblePerson},</if>",
            "<if test='archivalInfo.dateTime != null'>date_time = #{archivalInfo.dateTime},</if>",
            "<if test='archivalInfo.standards != null and archivalInfo.standards != \"\"'>standards = #{archivalInfo.standards},</if>",
            "<if test='archivalInfo.quantity != null and archivalInfo.quantity != \"\"'>quantity = #{archivalInfo.quantity},</if>",
            "<if test='archivalInfo.pageCount != null and archivalInfo.pageCount != \"\"'>page_count = #{archivalInfo.pageCount},</if>",
            "<if test='archivalInfo.archiveUnit != null and archivalInfo.archiveUnit != \"\"'>archive_unit = #{archivalInfo.archiveUnit},</if>",
            "<if test='archivalInfo.transferor != null and archivalInfo.transferor != \"\"'>transferor = #{archivalInfo.transferor},</if>",
            "<if test='archivalInfo.receiver != null and archivalInfo.receiver != \"\"'>receiver = #{archivalInfo.receiver},</if>",
            "<if test='archivalInfo.transferTime != null'>transfer_time = #{archivalInfo.transferTime},</if>",
            "</set>",
            "WHERE student_id = #{archivalInfo.studentId}",
            "</script>"
    })
    int updateArchival(@Param("archivalInfo") ArchivalInfo archivalInfo);
    @Update({
            "<script>",
            "UPDATE jlnu_degree_info",
            "<set>",
            "student_id = #{degreeInfo.studentId},",
            "<if test='degreeInfo.degreeCertificateNum != null and degreeInfo.degreeCertificateNum != \"\"'>degree_certificate_num = #{degreeInfo.degreeCertificateNum},</if>",
            "<if test='degreeInfo.degreeCertificateDate != null'>degree_certificate_date = #{degreeInfo.degreeCertificateDate},</if>",
            "<if test='degreeInfo.degreeLevel != null and degreeInfo.degreeLevel != \"\"'>degree_level = #{degreeInfo.degreeLevel},</if>",
            "<if test='degreeInfo.officerIdNum != null and degreeInfo.officerIdNum != \"\"'>officer_id_num = #{degreeInfo.officerIdNum},</if>",
            "<if test='degreeInfo.entranceDate != null'>entrance_date = #{degreeInfo.entranceDate},</if>",
            "<if test='degreeInfo.graduationDate != null'>graduation_date = #{degreeInfo.graduationDate},</if>",
            "</set>",
            "WHERE student_id = #{degreeInfo.studentId}",
            "</script>"
    })
    void updateDegreeInfo(@Param("degreeInfo") DegreeInfo degreeInfo);

    @Update({
            "<script>",
            "UPDATE jlnu_employment_info",
            "<set>",
            "student_id = #{employmentInfo.studentId},",
            "<if test='employmentInfo.grade != null and employmentInfo.grade != \"\"'>grade = #{employmentInfo.grade},</if>",
            "<if test='employmentInfo.classId != null and employmentInfo.classId != \"\"'>class_id = #{employmentInfo.classId},</if>",
            "<if test='employmentInfo.age != null and employmentInfo.age != \"\"'>age = #{employmentInfo.age},</if>",
            "<if test='employmentInfo.schoolCode != null and employmentInfo.schoolCode != \"\"'>school_code = #{employmentInfo.schoolCode},</if>",
            "<if test='employmentInfo.graduationCollege != null and employmentInfo.graduationCollege != \"\"'>graduation_college = #{employmentInfo.graduationCollege},</if>",
            "<if test='employmentInfo.majorCode != null and employmentInfo.majorCode != \"\"'>major_code = #{employmentInfo.majorCode},</if>",
            "<if test='employmentInfo.qualification != null and employmentInfo.qualification != \"\"'>qualification = #{employmentInfo.qualification},</if>",
            "<if test='employmentInfo.entranceDate != null'>entrance_date = #{employmentInfo.entranceDate},</if>",
            "<if test='employmentInfo.graduationDate != null'>graduation_date = #{employmentInfo.graduationDate},</if>",
            "<if test='employmentInfo.completionConclusion != null and employmentInfo.completionConclusion != \"\"'>completion_conclusion = #{employmentInfo.completionConclusion},</if>",
            "<if test='employmentInfo.graduationDestination != null and employmentInfo.graduationDestination != \"\"'>graduation_destination = #{employmentInfo.graduationDestination},</if>",
            "<if test='employmentInfo.employmentName != null and employmentInfo.employmentName != \"\"'>employment_name = #{employmentInfo.employmentName},</if>",
            "<if test='employmentInfo.employmentAddress != null and employmentInfo.employmentAddress != \"\"'>employment_address = #{employmentInfo.employmentAddress},</if>",
            "<if test='employmentInfo.archiveTransferNum != null and employmentInfo.archiveTransferNum != \"\"'>archive_transfer_num = #{employmentInfo.archiveTransferNum},</if>",
            "<if test='employmentInfo.archiveTransferSort != null and employmentInfo.archiveTransferSort != \"\"'>archive_transfer_sort = #{employmentInfo.archiveTransferSort},</if>",
            "<if test='employmentInfo.receivePostalCode != null and employmentInfo.receivePostalCode != \"\"'>receive_postal_code = #{employmentInfo.receivePostalCode},</if>",
            "<if test='employmentInfo.receiveUnitName != null and employmentInfo.receiveUnitName != \"\"'>receive_unit_name = #{employmentInfo.receiveUnitName},</if>",
            "<if test='employmentInfo.receiveUnitAddress != null and employmentInfo.receiveUnitAddress != \"\"'>receive_unit_address = #{employmentInfo.receiveUnitAddress},</if>",
            "<if test='employmentInfo.receiveUnitAddressCode != null and employmentInfo.receiveUnitAddressCode != \"\"'>receive_unit_address_code = #{employmentInfo.receiveUnitAddressCode},</if>",
            "<if test='employmentInfo.archiveReceiver != null and employmentInfo.archiveReceiver != \"\"'>archive_receiver = #{employmentInfo.archiveReceiver},</if>",
            "<if test='employmentInfo.archiveReceiverPhone != null and employmentInfo.archiveReceiverPhone != \"\"'>archive_receiver_phone = #{employmentInfo.archiveReceiverPhone},</if>",
            "<if test='employmentInfo.sender != null and employmentInfo.sender != \"\"'>sender = #{employmentInfo.sender},</if>",
            "<if test='employmentInfo.sendTime != null'>send_time = #{employmentInfo.sendTime},</if>",
            "<if test='employmentInfo.shipMethod != null and employmentInfo.shipMethod != \"\"'>ship_method = #{employmentInfo.shipMethod},</if>",
            "<if test='employmentInfo.trackingNumber != null and employmentInfo.trackingNumber != \"\"'>tracking_number = #{employmentInfo.trackingNumber},</if>",
            "<if test='employmentInfo.receipt != null and employmentInfo.receipt != \"\"'>receipt = #{employmentInfo.receipt},</if>",
            "<if test='employmentInfo.studentPhoneNum != null and employmentInfo.studentPhoneNum != \"\"'>student_phone_num = #{employmentInfo.studentPhoneNum},</if>",
            "<if test='employmentInfo.responsiblePerson != null and employmentInfo.responsiblePerson != \"\"'>responsible_person = #{employmentInfo.responsiblePerson},</if>",
            "<if test='employmentInfo.dateTime != null'>date_time = #{employmentInfo.dateTime},</if>",
            "<if test='employmentInfo.standards != null and employmentInfo.standards != \"\"'>standards = #{employmentInfo.standards},</if>",
            "<if test='employmentInfo.quantity != null and employmentInfo.quantity != \"\"'>quantity = #{employmentInfo.quantity},</if>",
            "<if test='employmentInfo.pageCount != null and employmentInfo.pageCount != \"\"'>page_count = #{employmentInfo.pageCount},</if>",
            "<if test='employmentInfo.archiveUnit != null and employmentInfo.archiveUnit != \"\"'>archive_unit = #{employmentInfo.archiveUnit},</if>",
            "<if test='employmentInfo.transferor != null and employmentInfo.transferor != \"\"'>transferor = #{employmentInfo.transferor},</if>",
            "<if test='employmentInfo.receiver != null and employmentInfo.receiver != \"\"'>receiver = #{employmentInfo.receiver},</if>",
            "<if test='employmentInfo.transferTime != null'>transfer_time = #{employmentInfo.transferTime},</if>",
            "</set>",
            "WHERE student_id = #{employmentInfo.studentId}",
            "</script>"
    })
    void updateEmploymentInfo(@Param("employmentInfo") EmploymentInfo employmentInfo);

    @Update({
            "<script>",
            "UPDATE jlnu_graduation_info",
            "<set>",
            "student_id = #{graduationInfo.studentId},",
            "<if test='graduationInfo.grade != null and graduationInfo.grade != \"\"'>grade = #{graduationInfo.grade},</if>",
            "<if test='graduationInfo.classId != null and graduationInfo.classId != \"\"'>class_id = #{graduationInfo.classId},</if>",
            "<if test='graduationInfo.age != null and graduationInfo.age != \"\"'>age = #{graduationInfo.age},</if>",
            "<if test='graduationInfo.schoolCode != null and graduationInfo.schoolCode != \"\"'>school_code = #{graduationInfo.schoolCode},</if>",
            "<if test='graduationInfo.majorCode != null and graduationInfo.majorCode != \"\"'>major_code = #{graduationInfo.majorCode},</if>",
            "<if test='graduationInfo.entranceDate != null'>entrance_date = #{graduationInfo.entranceDate},</if>",
            "<if test='graduationInfo.graduationDate != null'>graduation_date = #{graduationInfo.graduationDate},</if>",
            "<if test='graduationInfo.graduationCollege != null and graduationInfo.graduationCollege != \"\"'>graduation_college = #{graduationInfo.graduationCollege},</if>",
            "<if test='graduationInfo.completionConclusion != null and graduationInfo.completionConclusion != \"\"'>completion_conclusion = #{graduationInfo.completionConclusion},</if>",
            "<if test='graduationInfo.diplomaNum != null and graduationInfo.diplomaNum != \"\"'>diploma_num = #{graduationInfo.diplomaNum},</if>",
            "<if test='graduationInfo.diplomaDate != null'>diploma_date = #{graduationInfo.diplomaDate},</if>",
            "<if test='graduationInfo.degreeLevel != null and graduationInfo.degreeLevel != \"\"'>degree_level = #{graduationInfo.degreeLevel},</if>",
            "<if test='graduationInfo.degreeType != null and graduationInfo.degreeType != \"\"'>degree_type = #{graduationInfo.degreeType},</if>",
            "<if test='graduationInfo.disciplineMajor != null and graduationInfo.disciplineMajor != \"\"'>discipline_major = #{graduationInfo.disciplineMajor},</if>",
            "<if test='graduationInfo.supervisor != null and graduationInfo.supervisor != \"\"'>supervisor = #{graduationInfo.supervisor},</if>",
            "<if test='graduationInfo.thesisTitle != null and graduationInfo.thesisTitle != \"\"'>thesis_title = #{graduationInfo.thesisTitle},</if>",
            "<if test='graduationInfo.degreeCertificateNum != null and graduationInfo.degreeCertificateNum != \"\"'>degree_certificate_num = #{graduationInfo.degreeCertificateNum},</if>",
            "<if test='graduationInfo.degreeCertificateDate != null'>degree_certificate_date = #{graduationInfo.degreeCertificateDate},</if>",
            "<if test='graduationInfo.presidentName != null and graduationInfo.presidentName != \"\"'>president_name = #{graduationInfo.presidentName},</if>",
            "<if test='graduationInfo.correspondenceStation != null and graduationInfo.correspondenceStation != \"\"'>correspondence_station = #{graduationInfo.correspondenceStation},</if>",
            "<if test='graduationInfo.responsiblePerson != null and graduationInfo.responsiblePerson != \"\"'>responsible_person = #{graduationInfo.responsiblePerson},</if>",
            "<if test='graduationInfo.dateTime != null'>date_time = #{graduationInfo.dateTime},</if>",
            "<if test='graduationInfo.standards != null and graduationInfo.standards != \"\"'>standards = #{graduationInfo.standards},</if>",
            "<if test='graduationInfo.quantity != null and graduationInfo.quantity != \"\"'>quantity = #{graduationInfo.quantity},</if>",
            "<if test='graduationInfo.pageCount != null and graduationInfo.pageCount != \"\"'>page_count = #{graduationInfo.pageCount},</if>",
            "<if test='graduationInfo.archiveUnit != null and graduationInfo.archiveUnit != \"\"'>archive_unit = #{graduationInfo.archiveUnit},</if>",
            "<if test='graduationInfo.transferor != null and graduationInfo.transferor != \"\"'>transferor = #{graduationInfo.transferor},</if>",
            "<if test='graduationInfo.receiver != null and graduationInfo.receiver != \"\"'>receiver = #{graduationInfo.receiver},</if>",
            "<if test='graduationInfo.transferTime != null'>transfer_time = #{graduationInfo.transferTime},</if>",
            "</set>",
            "WHERE student_id = #{graduationInfo.studentId}",
            "</script>"
    })
    int updateGraduationInfo(@Param("graduationInfo") GraduationInfo graduationInfo);


    @Update({
            "<script>",
            "UPDATE jlnu_mailing_info",
            "<set>",
            "student_id = #{mailingInfo.studentId},",
            "<if test='mailingInfo.grade != null and mailingInfo.grade != \"\"'>grade = #{mailingInfo.grade},</if>",
            "<if test='mailingInfo.classId != null and mailingInfo.classId != \"\"'>class_id = #{mailingInfo.classId},</if>",
            "<if test='mailingInfo.age != null and mailingInfo.age != \"\"'>age = #{mailingInfo.age},</if>",
            "<if test='mailingInfo.schoolCode != null and mailingInfo.schoolCode != \"\"'>school_code = #{mailingInfo.schoolCode},</if>",
            "<if test='mailingInfo.graduationCollege != null and mailingInfo.graduationCollege != \"\"'>graduation_college = #{mailingInfo.graduationCollege},</if>",
            "<if test='mailingInfo.majorCode != null and mailingInfo.majorCode != \"\"'>major_code = #{mailingInfo.majorCode},</if>",
            "<if test='mailingInfo.qualification != null and mailingInfo.qualification != \"\"'>qualification = #{mailingInfo.qualification},</if>",
            "<if test='mailingInfo.entranceDate != null'>entrance_date = #{mailingInfo.entranceDate},</if>",
            "<if test='mailingInfo.graduationDate != null'>graduation_date = #{mailingInfo.graduationDate},</if>",
            "<if test='mailingInfo.completionConclusion != null and mailingInfo.completionConclusion != \"\"'>completion_conclusion = #{mailingInfo.completionConclusion},</if>",
            "<if test='mailingInfo.graduationDestination != null and mailingInfo.graduationDestination != \"\"'>graduation_destination = #{mailingInfo.graduationDestination},</if>",
            "<if test='mailingInfo.employmentName != null and mailingInfo.employmentName != \"\"'>employment_name = #{mailingInfo.employmentName},</if>",
            "<if test='mailingInfo.employmentAddress != null and mailingInfo.employmentAddress != \"\"'>employment_address = #{mailingInfo.employmentAddress},</if>",
            "<if test='mailingInfo.archiveTransferNum != null and mailingInfo.archiveTransferNum != \"\"'>archive_transfer_num = #{mailingInfo.archiveTransferNum},</if>",
            "<if test='mailingInfo.archiveTransferSort != null and mailingInfo.archiveTransferSort != \"\"'>archive_transfer_sort = #{mailingInfo.archiveTransferSort},</if>",
            "<if test='mailingInfo.receivePostalCode != null and mailingInfo.receivePostalCode != \"\"'>receive_postal_code = #{mailingInfo.receivePostalCode},</if>",
            "<if test='mailingInfo.receiveUnitName != null and mailingInfo.receiveUnitName != \"\"'>receive_unit_name = #{mailingInfo.receiveUnitName},</if>",
            "<if test='mailingInfo.receiveUnitAddress != null and mailingInfo.receiveUnitAddress != \"\"'>receive_unit_address = #{mailingInfo.receiveUnitAddress},</if>",
            "<if test='mailingInfo.receiveUnitAddressCode != null and mailingInfo.receiveUnitAddressCode != \"\"'>receive_unit_address_code = #{mailingInfo.receiveUnitAddressCode},</if>",
            "<if test='mailingInfo.archiveReceiver != null and mailingInfo.archiveReceiver != \"\"'>archive_receiver = #{mailingInfo.archiveReceiver},</if>",
            "<if test='mailingInfo.archiveReceiverPhone != null and mailingInfo.archiveReceiverPhone != \"\"'>archive_receiver_phone = #{mailingInfo.archiveReceiverPhone},</if>",
            "<if test='mailingInfo.sender != null and mailingInfo.sender != \"\"'>sender = #{mailingInfo.sender},</if>",
            "<if test='mailingInfo.sendTime != null'>send_time = #{mailingInfo.sendTime},</if>",
            "<if test='mailingInfo.shipMethod != null and mailingInfo.shipMethod != \"\"'>ship_method = #{mailingInfo.shipMethod},</if>",
            "<if test='mailingInfo.trackingNumber != null and mailingInfo.trackingNumber != \"\"'>tracking_number = #{mailingInfo.trackingNumber},</if>",
            "<if test='mailingInfo.receipt != null and mailingInfo.receipt != \"\"'>receipt = #{mailingInfo.receipt},</if>",
            "<if test='mailingInfo.studentPhoneNum != null and mailingInfo.studentPhoneNum != \"\"'>student_phone_num = #{mailingInfo.studentPhoneNum},</if>",
            "<if test='mailingInfo.responsiblePerson != null and mailingInfo.responsiblePerson != \"\"'>responsible_person = #{mailingInfo.responsiblePerson},</if>",
            "<if test='mailingInfo.dateTime != null'>date_time = #{mailingInfo.dateTime},</if>",
            "<if test='mailingInfo.standards != null and mailingInfo.standards != \"\"'>standards = #{mailingInfo.standards},</if>",
            "<if test='mailingInfo.quantity != null and mailingInfo.quantity != \"\"'>quantity = #{mailingInfo.quantity},</if>",
            "<if test='mailingInfo.pageCount != null and mailingInfo.pageCount != \"\"'>page_count = #{mailingInfo.pageCount},</if>",
            "<if test='mailingInfo.archiveUnit != null and mailingInfo.archiveUnit != \"\"'>archive_unit = #{mailingInfo.archiveUnit},</if>",
            "<if test='mailingInfo.transferor != null and mailingInfo.transferor != \"\"'>transferor = #{mailingInfo.transferor},</if>",
            "<if test='mailingInfo.receiver != null and mailingInfo.receiver != \"\"'>receiver = #{mailingInfo.receiver},</if>",
            "<if test='mailingInfo.transferTime != null'>transfer_time = #{mailingInfo.transferTime},</if>",
            "</set>",
            "WHERE student_id = #{mailingInfo.studentId}",
            "</script>"
    })
    int updateMailingInfo(@Param("mailingInfo") MailingInfo mailingInfo);

    @Update({
            "<script>",
            "UPDATE jlnu_qualification_info",
            "<set>",
            "student_id = #{qualificationInfo.studentId},",
            "<if test='qualificationInfo.nativePlace != null and qualificationInfo.nativePlace != \"\"'>native_place = #{qualificationInfo.nativePlace},</if>",
            "<if test='qualificationInfo.degreeCertificateNum != null and qualificationInfo.degreeCertificateNum != \"\"'>degree_certificate_num = #{qualificationInfo.degreeCertificateNum},</if>",
            "<if test='qualificationInfo.degreeCertificateDate != null'>degree_certificate_date = #{qualificationInfo.degreeCertificateDate},</if>",
            "<if test='qualificationInfo.officerIdNum != null and qualificationInfo.officerIdNum != \"\"'>officer_id_num = #{qualificationInfo.officerIdNum},</if>",
            "<if test='qualificationInfo.disciplineMajor != null and qualificationInfo.disciplineMajor != \"\"'>discipline_major = #{qualificationInfo.disciplineMajor},</if>",
            "<if test='qualificationInfo.degreeType != null and qualificationInfo.degreeType != \"\"'>degree_type = #{qualificationInfo.degreeType},</if>",
            "<if test='qualificationInfo.studyStartTime != null'>study_start_time = #{qualificationInfo.studyStartTime},</if>",
            "<if test='qualificationInfo.studyEndTime != null'>study_end_time = #{qualificationInfo.studyEndTime},</if>",
            "<if test='qualificationInfo.documentTitle != null and qualificationInfo.documentTitle != \"\"'>document_title = #{qualificationInfo.documentTitle},</if>",
            "<if test='qualificationInfo.documentDate != null'>document_date = #{qualificationInfo.documentDate},</if>",
            "</set>",
            "WHERE student_id = #{qualificationInfo.studentId}",
            "</script>"
    })
    int updateQualificationInfo(@Param("qualificationInfo") QualificationInfo qualificationInfo);

    @Update({
            "<script>",
            "UPDATE jlnu_student_status_info",
            "<set>",
            "student_id = #{studentStatusInfo.studentId},",
            "<if test='studentStatusInfo.age != null and studentStatusInfo.age != \"\"'>age = #{studentStatusInfo.age},</if>",
            "<if test='studentStatusInfo.grade != null and studentStatusInfo.grade != \"\"'>grade = #{studentStatusInfo.grade},</if>",
            "<if test='studentStatusInfo.classId != null and studentStatusInfo.classId != \"\"'>class_id = #{studentStatusInfo.classId},</if>",
            "<if test='studentStatusInfo.entranceDate != null'>entrance_date = #{studentStatusInfo.entranceDate},</if>",
            "<if test='studentStatusInfo.expectedGraduationDate != null'>expected_graduation_date = #{studentStatusInfo.expectedGraduationDate},</if>",
            "<if test='studentStatusInfo.majorCode != null and studentStatusInfo.majorCode != \"\"'>major_code = #{studentStatusInfo.majorCode},</if>",
            "<if test='studentStatusInfo.details != null and studentStatusInfo.details != \"\"'>details = #{studentStatusInfo.details},</if>",
            "<if test='studentStatusInfo.changeDate != null'>change_date = #{studentStatusInfo.changeDate},</if>",
            "<if test='studentStatusInfo.changeSort != null and studentStatusInfo.changeSort != \"\"'>change_sort = #{studentStatusInfo.changeSort},</if>",
            "<if test='studentStatusInfo.changeContent != null and studentStatusInfo.changeContent != \"\"'>change_content = #{studentStatusInfo.changeContent},</if>",
            "<if test='studentStatusInfo.nameBeforeChange != null and studentStatusInfo.nameBeforeChange != \"\"'>name_before_change = #{studentStatusInfo.nameBeforeChange},</if>",
            "<if test='studentStatusInfo.nameChanged != null and studentStatusInfo.nameChanged != \"\"'>name_changed = #{studentStatusInfo.nameChanged},</if>",
            "<if test='studentStatusInfo.responsiblePerson != null and studentStatusInfo.responsiblePerson != \"\"'>responsible_person = #{studentStatusInfo.responsiblePerson},</if>",
            "<if test='studentStatusInfo.dateTime != null'>date_time = #{studentStatusInfo.dateTime},</if>",
            "<if test='studentStatusInfo.standards != null and studentStatusInfo.standards != \"\"'>standards = #{studentStatusInfo.standards},</if>",
            "<if test='studentStatusInfo.quantity != null and studentStatusInfo.quantity != \"\"'>quantity = #{studentStatusInfo.quantity},</if>",
            "<if test='studentStatusInfo.pageCount != null and studentStatusInfo.pageCount != \"\"'>page_count = #{studentStatusInfo.pageCount},</if>",
            "<if test='studentStatusInfo.archiveUnit != null and studentStatusInfo.archiveUnit != \"\"'>archive_unit = #{studentStatusInfo.archiveUnit},</if>",
            "<if test='studentStatusInfo.transferor != null and studentStatusInfo.transferor != \"\"'>transferor = #{studentStatusInfo.transferor},</if>",
            "<if test='studentStatusInfo.receiver != null and studentStatusInfo.receiver != \"\"'>receiver = #{studentStatusInfo.receiver},</if>",
            "<if test='studentStatusInfo.transferTime != null'>transfer_time = #{studentStatusInfo.transferTime},</if>",
            "</set>",
            "WHERE student_id = #{studentStatusInfo.studentId}",
            "</script>"
    })
    int updateStudentStatusInfo(@Param("studentStatusInfo") StudentStatusInfo studentStatusInfo);

    String getNameById(String studentId);

    @Insert("insert into jlnu_admission_info (student_id,admission_academy,admission_num,examinee_num,name,gender,birthday,political_outlook,nation,id_card,graduation_school) values(" +
            "#{studentId},#{admissionAcademy},#{admissionNum},#{examineeNum},#{name},#{gender},#{birthday},#{politicalOutlook},#{nation},#{idCard},#{graduationSchool},#{year})")
    void insertAdmission(AdmissionInfo admissionInfo);

    void updateAdmission(String addmission, String applyNow, String studentId);

    @Update({
            "<script>",
            "UPDATE jlnu_admission_info",
            "<set>",
            "<if test='archivalNum != null'>archival_num = #{archivalNum},</if>",
            "<if test='caseTitle != null'>case_title = #{caseTitle},</if>",
            "<if test='fileTitle != null'>file_title = #{fileTitle},</if>",
            "<if test='saveLocation != null'>save_location = #{saveLocation},</if>",
            "<if test='pageLocation != null'>page_location = #{pageLocation},</if>",
            "<if test='pageNum != null'>page_num = #{pageNum},</if>",
            "<if test='examineeNum != null'>examinee_num = #{examineeNum},</if>",
            "<if test='admissionNum != null'>admission_num = #{admissionNum},</if>",
            "<if test='studentId != null'>student_id = #{studentId},</if>",
            "<if test='name != null'>name = #{name},</if>",
            "<if test='gender != null'>gender = #{gender},</if>",
            "<if test='birthday != null'>birthday = #{birthday},</if>",
            "<if test='politicalOutlook != null'>political_outlook = #{politicalOutlook},</if>",
            "<if test='nation != null'>nation = #{nation},</if>",
            "<if test='idCard != null'>id_card = #{idCard},</if>",
            "<if test='planNature != null'>plan_nature = #{planNature},</if>",
            "<if test='admissionSchools != null'>admission_schools = #{admissionSchools},</if>",
            "<if test='admissionAcademy != null'>admission_academy = #{admissionAcademy},</if>",
            "<if test='admissionMajor != null'>admission_major = #{admissionMajor},</if>",
            "<if test='admissionTime != null'>admission_time = #{admissionTime},</if>",
            "<if test='gradation != null'>gradation = #{gradation},</if>",
            "<if test='educationalSystem != null'>educational_system = #{educationalSystem},</if>",
            "<if test='learningForms != null'>learning_forms = #{learningForms},</if>",
            "<if test='examineeSort != null'>examinee_sort = #{examineeSort},</if>",
            "<if test='batch != null'>batch = #{batch},</if>",
            "<if test='graduationSchool != null'>graduation_school = #{graduationSchool},</if>",
            "<if test='sourceArea != null'>source_area = #{sourceArea},</if>",
            "<if test='areaName != null'>area_name = #{areaName},</if>",
            "<if test='homeAddress != null'>home_address = #{homeAddress},</if>",
            "<if test='postalCode != null'>postal_code = #{postalCode},</if>",
            "<if test='phoneNum != null'>phone_num = #{phoneNum},</if>",
            "<if test='infoSource != null'>info_source = #{infoSource},</if>",
            "<if test='remarks != null'>remarks = #{remarks},</if>",
            "</set>",
            "WHERE student_id = #{studentId}",
            "</script>"
    })
    void updateAdmissions(AdmissionInfo admissionInfo);

    void updateAge(String age, String id);

    void updatePoliticalOutlook(String politicalStatus, String id);


    void updatePhoneNum(String contactNumber, String id);

    void updateHomeAddress(String familyAddress, String id);

    void updatePostalCode(String postalCode, String id);


    int checkStudentId(String studentId);

    /**
     * 根据 ID 批量查询录取信息表
     */
    List<AdmissionInfo> selectBatchIds(@Param("ids") List<String> ids);

    /**
     * 根据 ID 单条查询录取信息表
     */
    AdmissionInfo selectBatchId(String studentId);

    /**
     * 根据学号批量查询教学档案表
     */
    List<JlnuTeachingArchives> selectTecBatchIds(@Param("studentIds") List<String> studentIds);

    JlnuTeachingArchives selectByStudentId(String studentId);

    void updateById(JlnuTeachingArchives existingRecord);

    void insert(JlnuTeachingArchives newRecord);

    void insertImportLog(ImportFailLog failLog);

    @Insert("<script>" +
            "INSERT INTO jlnu_teacthing_archives (archive_code, full_set_code, category_code, category_id, project_id, " +
            "directory_code, annual, retention_period_code, institution, case_number, item_number, case_title, document_title, " +
            "date_time, responsible_person, specification, item_count, page_count, retention_period, confidentiality_level, " +
            "disclosure_attribute, open_flag, remark, keywords, storage_location, cataloger, catalog_date, archiving_unit, archiver, " +
            "archive_time, electronic_document, electronic_document_metadata, notes, student_id) " +
            "VALUES " +
            "<foreach collection='studentIds' item='studentId' separator=','>" +
            "(#{admissionInfoDto.archiveCode}, #{admissionInfoDto.fullSetCode}, #{admissionInfoDto.categoryCode}, " +
            "#{admissionInfoDto.categoryId}, #{admissionInfoDto.projectId}, #{admissionInfoDto.directoryCode}, #{admissionInfoDto.annual}, " +
            "#{admissionInfoDto.retentionPeriodCode}, #{admissionInfoDto.institution}, #{admissionInfoDto.caseNumber}, " +
            "#{admissionInfoDto.itemNumber}, #{admissionInfoDto.caseTitle}, #{admissionInfoDto.documentTitle}, #{admissionInfoDto.dateTime}, " +
            "#{admissionInfoDto.responsiblePerson}, #{admissionInfoDto.specification}, #{admissionInfoDto.itemCount}, #{admissionInfoDto.pageCount}, " +
            "#{admissionInfoDto.retentionPeriod}, #{admissionInfoDto.confidentialityLevel}, #{admissionInfoDto.disclosureAttribute}, " +
            "#{admissionInfoDto.openFlag}, #{admissionInfoDto.remark}, #{admissionInfoDto.keywords}, #{admissionInfoDto.storageLocation}, " +
            "#{admissionInfoDto.cataloger}, #{admissionInfoDto.catalogDate}, #{admissionInfoDto.archivingUnit}, #{admissionInfoDto.archiver}, " +
            "#{admissionInfoDto.archiveTime}, #{admissionInfoDto.electronicDocument}, #{admissionInfoDto.electronicDocumentMetadata}, " +
            "#{admissionInfoDto.notes}, #{studentId})" +
            "</foreach> " +
            "ON DUPLICATE KEY UPDATE " +
            "archive_code = VALUES(archive_code), full_set_code = VALUES(full_set_code), category_code = VALUES(category_code), " +
            "category_id = VALUES(category_id), project_id = VALUES(project_id), directory_code = VALUES(directory_code), " +
            "annual = VALUES(annual), retention_period_code = VALUES(retention_period_code), institution = VALUES(institution), " +
            "case_number = VALUES(case_number), item_number = VALUES(item_number), case_title = VALUES(case_title), " +
            "document_title = VALUES(document_title), date_time = VALUES(date_time), responsible_person = VALUES(responsible_person), " +
            "specification = VALUES(specification), item_count = VALUES(item_count), page_count = VALUES(page_count), " +
            "retention_period = VALUES(retention_period), confidentiality_level = VALUES(confidentiality_level), " +
            "disclosure_attribute = VALUES(disclosure_attribute), open_flag = VALUES(open_flag), remark = VALUES(remark), " +
            "keywords = VALUES(keywords), storage_location = VALUES(storage_location), cataloger = VALUES(cataloger), " +
            "catalog_date = VALUES(catalog_date), archiving_unit = VALUES(archiving_unit), archiver = VALUES(archiver), " +
            "archive_time = VALUES(archive_time), electronic_document = VALUES(electronic_document), " +
            "electronic_document_metadata = VALUES(electronic_document_metadata), notes = VALUES(notes)" +
            "</script>")
    void updateTeacherData(@Param("studentIds") List<String> studentIds, @Param("admissionInfoDto") AdmissionInfoDto admissionInfoDto);


    List<ImportFailLog> selectPage(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("startTime") Date startTime, @Param("endTime")Date endTime);

    int selectTotalCount(@Param("startTime") Date startTime,
                         @Param("endTime") Date endTime);
    List<AdmissionInfo> selectAllByOfficeId(PostgraduateReqVo admissionInfoReqVo);

    int batchUpdateById(@Param("ids") List<String> ids,@Param("admissionInfo") AdmissionInfo admissionInfo);

    int batchUpdateAdmissionInfo(@Param("admissionInfos") List<AdmissionInfo> admissionInfos,@Param("transferState") String transferState);

//    int batchUpdateeAdmissionInfoById(@Param("ids") List<Integer> ids,@Param("admissionInfo") AdmissionInfo admissionInfo);


    @Update({
            "<script>",
            "UPDATE jlnu_admission_info",
            "<set>",
            "archival_num = CASE WHEN #{dto.archivalNum} IS NOT NULL AND #{dto.archivalNum} != '' THEN #{dto.archivalNum} ELSE archival_num END,",
            "case_title = CASE WHEN #{dto.caseTitle} IS NOT NULL AND #{dto.caseTitle} != '' THEN #{dto.caseTitle} ELSE case_title END,",
            "file_title = CASE WHEN #{dto.fileTitle} IS NOT NULL AND #{dto.fileTitle} != '' THEN #{dto.fileTitle} ELSE file_title END,",
            "save_location = CASE WHEN #{dto.saveLocation} IS NOT NULL AND #{dto.saveLocation} != '' THEN #{dto.saveLocation} ELSE save_location END,",
            "page_location = CASE WHEN #{dto.pageLocation} IS NOT NULL AND #{dto.pageLocation} != '' THEN #{dto.pageLocation} ELSE page_location END,",
            "page_num = CASE WHEN #{dto.pageNum} IS NOT NULL AND #{dto.pageNum} != '' THEN #{dto.pageNum} ELSE page_num END,",
            "examinee_num = CASE WHEN #{dto.examineeNum} IS NOT NULL AND #{dto.examineeNum} != '' THEN #{dto.examineeNum} ELSE examinee_num END,",
            "admission_num = CASE WHEN #{dto.admissionNum} IS NOT NULL AND #{dto.admissionNum} != '' THEN #{dto.admissionNum} ELSE admission_num END,",
            "student_id = CASE WHEN #{dto.studentId} IS NOT NULL AND #{dto.studentId} != '' THEN #{dto.studentId} ELSE student_id END,",
            "name = CASE WHEN #{dto.name} IS NOT NULL AND #{dto.name} != '' THEN #{dto.name} ELSE name END,",
            "gender = CASE WHEN #{dto.gender} IS NOT NULL AND #{dto.gender} != '' THEN #{dto.gender} ELSE gender END,",
            "birthday = CASE WHEN #{dto.birthday} IS NOT NULL THEN #{dto.birthday} ELSE birthday END,",
            "political_outlook = CASE WHEN #{dto.politicalOutlook} IS NOT NULL AND #{dto.politicalOutlook} != '' THEN #{dto.politicalOutlook} ELSE political_outlook END,",
            "nation = CASE WHEN #{dto.nation} IS NOT NULL AND #{dto.nation} != '' THEN #{dto.nation} ELSE nation END,",
            "id_card = CASE WHEN #{dto.idCard} IS NOT NULL AND #{dto.idCard} != '' THEN #{dto.idCard} ELSE id_card END,",
            "plan_nature = CASE WHEN #{dto.planNature} IS NOT NULL AND #{dto.planNature} != '' THEN #{dto.planNature} ELSE plan_nature END,",
            "admission_schools = CASE WHEN #{dto.admissionSchools} IS NOT NULL AND #{dto.admissionSchools} != '' THEN #{dto.admissionSchools} ELSE admission_schools END,",
            "admission_academy = CASE WHEN #{dto.admissionAcademy} IS NOT NULL AND #{dto.admissionAcademy} != '' THEN #{dto.admissionAcademy} ELSE admission_academy END,",
            "admission_major = CASE WHEN #{dto.admissionMajor} IS NOT NULL AND #{dto.admissionMajor} != '' THEN #{dto.admissionMajor} ELSE admission_major END,",
            "admission_time = CASE WHEN #{dto.admissionTime} IS NOT NULL AND #{dto.admissionTime} != '' THEN #{dto.admissionTime} ELSE admission_time END,",
            "gradation = CASE WHEN #{dto.gradation} IS NOT NULL AND #{dto.gradation} != '' THEN #{dto.gradation} ELSE gradation END,",
            "educational_system = CASE WHEN #{dto.educationalSystem} IS NOT NULL AND #{dto.educationalSystem} != '' THEN #{dto.educationalSystem} ELSE educational_system END,",
            "learning_forms = CASE WHEN #{dto.learningForms} IS NOT NULL AND #{dto.learningForms} != '' THEN #{dto.learningForms} ELSE learning_forms END,",
            "examinee_sort = CASE WHEN #{dto.examineeSort} IS NOT NULL AND #{dto.examineeSort} != '' THEN #{dto.examineeSort} ELSE examinee_sort END,",
            "batch = CASE WHEN #{dto.batch} IS NOT NULL AND #{dto.batch} != '' THEN #{dto.batch} ELSE batch END,",
            "graduation_school = CASE WHEN #{dto.graduationSchool} IS NOT NULL AND #{dto.graduationSchool} != '' THEN #{dto.graduationSchool} ELSE graduation_school END,",
            "source_area = CASE WHEN #{dto.sourceArea} IS NOT NULL AND #{dto.sourceArea} != '' THEN #{dto.sourceArea} ELSE source_area END,",
            "area_name = CASE WHEN #{dto.areaName} IS NOT NULL AND #{dto.areaName} != '' THEN #{dto.areaName} ELSE area_name END,",
            "home_address = CASE WHEN #{dto.homeAddress} IS NOT NULL AND #{dto.homeAddress} != '' THEN #{dto.homeAddress} ELSE home_address END,",
            "postal_code = CASE WHEN #{dto.postalCode} IS NOT NULL AND #{dto.postalCode} != '' THEN #{dto.postalCode} ELSE postal_code END,",
            "phone_num = CASE WHEN #{dto.phoneNum} IS NOT NULL AND #{dto.phoneNum} != '' THEN #{dto.phoneNum} ELSE phone_num END,",
            "info_source = CASE WHEN #{dto.infoSource} IS NOT NULL AND #{dto.infoSource} != '' THEN #{dto.infoSource} ELSE info_source END,",
            "remarks = CASE WHEN #{dto.remarks} IS NOT NULL AND #{dto.remarks} != '' THEN #{dto.remarks} ELSE remarks END,",
            "class_id = CASE WHEN #{dto.classId} IS NOT NULL AND #{dto.classId} != '' THEN #{dto.classId} ELSE class_id END,",
            "category = CASE WHEN #{dto.category} IS NOT NULL AND #{dto.category} != '' THEN #{dto.category} ELSE category END,",
            "office_id = CASE WHEN #{dto.officeId} IS NOT NULL AND #{dto.officeId} != '' THEN #{dto.officeId} ELSE office_id END,",
            "approve_state = CASE WHEN #{dto.approveState} IS NOT NULL THEN #{dto.approveState} ELSE approve_state END,",
            "approve_remark = CASE WHEN #{dto.approveRemark} IS NOT NULL AND #{dto.approveRemark} != '' THEN #{dto.approveRemark} ELSE approve_remark END,",
            "transfer_state = CASE WHEN #{dto.transferState} IS NOT NULL THEN #{dto.transferState} ELSE transfer_state END,",
            "transfer_remarks = CASE WHEN #{dto.transferRemarks} IS NOT NULL AND #{dto.transferRemarks} != '' THEN #{dto.transferRemarks} ELSE transfer_remarks END,",
            "year = CASE WHEN #{dto.year} IS NOT NULL AND #{dto.year} != '' THEN #{dto.year} ELSE year END",
            "</set>",
            "WHERE id IN",
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"
    })
    int batchUpdateeAdmissionInfoById(@Param("ids") List<Integer> ids, @Param("dto") AdmissionInfo admissionInfo);

    //查询出所有录取信息数据
    List<AdmissionInfo> selectAllByState(AdmissionInfoReqVo admissionInfoReqVo);


    IPage<ImportFailLog> getImportPage(@Param("page") Page<ImportFailLog> page,@Param("message") String message,
                                       @Param("name")String name,@Param("xueHao")String xueHao,@Param("importType") String importType,@Param("templateId") String templateId);

    int importLogAdd(ImportFailLog param);
}
